package org.asdt.core.internal.antlr;

import antlr.collections.AST;

public class OffsetInfo {

	private static OffsetInfo nullOffset = null; 
	public static OffsetInfo getNullOffset(){
		if(nullOffset==null){
			nullOffset = new OffsetInfo(-1,-1);
		}
		return nullOffset;
	}
	
	private int line=-1;
	private int column=-1;
	public OffsetInfo(int line,int column) {
		this.line = line;
		this.column = column;
	}
	public OffsetInfo(){
		
	}
	public OffsetInfo(AST ast){
		this.line = ast.getLine();
		this.column = ast.getColumn();
	}
	protected void setLine(int line){
		this.line = line;
	}
	protected void setColumn(int column){
		this.column = column;
	}
	public int getLine(){
		return line;
	}
	public int getColumn(){
		return column;
	}

	public boolean isNull(){
		return this == getNullOffset();
	}
	public String toString(){
		return "["+line+""+column+"]";
	}
}